package com.ruoyi.keep.service.impl;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.keep.mapper.TcEvaluationMapper;
import com.ruoyi.keep.domain.TcEvaluation;
import com.ruoyi.keep.service.ITcEvaluationService;

/**
 * 团课评价管理Service业务层处理
 * 
 * @author yipeng
 * @date 2024-08-14
 */
@Service
public class TcEvaluationServiceImpl implements ITcEvaluationService 
{
    @Autowired
    private TcEvaluationMapper tcEvaluationMapper;

    /**
     * 查询团课评价管理
     * 
     * @param id 团课评价管理主键
     * @return 团课评价管理
     */
    @Override
    public TcEvaluation selectTcEvaluationById(Long id)
    {
        return tcEvaluationMapper.selectTcEvaluationById(id);
    }

    @Override
    public List<TcEvaluation> selectTcEvaluationByUserId(Long userId)
    {
        return tcEvaluationMapper.selectTcEvaluationByUserId(userId);
    }



    /**
     * 查询团课评价管理列表
     * 
     * @param tcEvaluation 团课评价管理
     * @return 团课评价管理
     */
    @Override
    public List<TcEvaluation> selectTcEvaluationList(TcEvaluation tcEvaluation)
    {
        return tcEvaluationMapper.selectTcEvaluationList(tcEvaluation);
    }

    /**
     * 新增团课评价管理
     * 
     * @param tcEvaluation 团课评价管理
     * @return 结果
     */
    @Override
    public int insertTcEvaluation(TcEvaluation tcEvaluation)
    {
        // 获取当前日期时间
        LocalDate now = LocalDate.now();
        Date nowDate = java.sql.Date.valueOf(now);
        tcEvaluation.setTime(nowDate);

        return tcEvaluationMapper.insertTcEvaluation(tcEvaluation);
    }

    /**
     * 修改团课评价管理
     * 
     * @param tcEvaluation 团课评价管理
     * @return 结果
     */
    @Override
    public int updateTcEvaluation(TcEvaluation tcEvaluation)
    {
        return tcEvaluationMapper.updateTcEvaluation(tcEvaluation);
    }

    /**
     * 批量删除团课评价管理
     * 
     * @param ids 需要删除的团课评价管理主键
     * @return 结果
     */
    @Override
    public int deleteTcEvaluationByIds(Long[] ids)
    {
        return tcEvaluationMapper.deleteTcEvaluationByIds(ids);
    }

    /**
     * 删除团课评价管理信息
     * 
     * @param id 团课评价管理主键
     * @return 结果
     */
    @Override
    public int deleteTcEvaluationById(Long id)
    {
        return tcEvaluationMapper.deleteTcEvaluationById(id);
    }
}
